﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace lcs.DAL
{
	/// <summary>
	/// 数据访问类:gradeinfo
	/// </summary>
	public partial class gradeinfo
	{
		public gradeinfo()
		{}
		#region  BasicMethod

		/// <summary>
		/// 得到最大ID
		/// </summary>
		public int GetMaxId()
		{
		return DbHelperSQL.GetMaxID("gdid", "gradeinfo"); 
		}

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(int monthsupplyid)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from gradeinfo");
			strSql.Append(" where monthsupplyid=@monthsupplyid");
			SqlParameter[] parameters = {
					new SqlParameter("@monthsupplyid", SqlDbType.Int,4)
			};
			parameters[0].Value = monthsupplyid;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(lcs.Model.gradeinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into gradeinfo(");
			strSql.Append("monthsupplyid,yls,yle,scs,sce,scwte1,zzs,zze,shs,she,dhs,dhe,azs,aze,azsum,yxgzs,yxgze,yxbfs,yxbfe,yxsum,ylmark,scmark,zzmark,shmark,dhmark,azmark,yxzlmark,pfdatetime)");
			strSql.Append(" values (");
			strSql.Append("@monthsupplyid,@yls,@yle,@scs,@sce,@scwte1,@zzs,@zze,@shs,@she,@dhs,@dhe,@azs,@aze,@azsum,@yxgzs,@yxgze,@yxbfs,@yxbfe,@yxsum,@ylmark,@scmark,@zzmark,@shmark,@dhmark,@azmark,@yxzlmark,@pfdatetime)");
			strSql.Append(";select @@IDENTITY");
			SqlParameter[] parameters = {
					new SqlParameter("@monthsupplyid", SqlDbType.Int,4),
					new SqlParameter("@yls", SqlDbType.Float,8),
					new SqlParameter("@yle", SqlDbType.Float,8),
					new SqlParameter("@scs", SqlDbType.Float,8),
					new SqlParameter("@sce", SqlDbType.Float,8),
					new SqlParameter("@scwte1", SqlDbType.Float,8),
					new SqlParameter("@zzs", SqlDbType.Float,8),
					new SqlParameter("@zze", SqlDbType.Float,8),
					new SqlParameter("@shs", SqlDbType.Float,8),
					new SqlParameter("@she", SqlDbType.Float,8),
					new SqlParameter("@dhs", SqlDbType.Float,8),
					new SqlParameter("@dhe", SqlDbType.Float,8),
					new SqlParameter("@azs", SqlDbType.Float,8),
					new SqlParameter("@aze", SqlDbType.Float,8),
					new SqlParameter("@azsum", SqlDbType.Float,8),
					new SqlParameter("@yxgzs", SqlDbType.Float,8),
					new SqlParameter("@yxgze", SqlDbType.Float,8),
					new SqlParameter("@yxbfs", SqlDbType.Float,8),
					new SqlParameter("@yxbfe", SqlDbType.Float,8),
					new SqlParameter("@yxsum", SqlDbType.Float,8),
					new SqlParameter("@ylmark", SqlDbType.Float,8),
					new SqlParameter("@scmark", SqlDbType.Float,8),
					new SqlParameter("@zzmark", SqlDbType.Float,8),
					new SqlParameter("@shmark", SqlDbType.Float,8),
					new SqlParameter("@dhmark", SqlDbType.Float,8),
					new SqlParameter("@azmark", SqlDbType.Float,8),
					new SqlParameter("@yxzlmark", SqlDbType.Float,8),
					new SqlParameter("@pfdatetime", SqlDbType.DateTime)};
			parameters[0].Value = model.monthsupplyid;
			parameters[1].Value = model.yls;
			parameters[2].Value = model.yle;
			parameters[3].Value = model.scs;
			parameters[4].Value = model.sce;
			parameters[5].Value = model.scwte1;
			parameters[6].Value = model.zzs;
			parameters[7].Value = model.zze;
			parameters[8].Value = model.shs;
			parameters[9].Value = model.she;
			parameters[10].Value = model.dhs;
			parameters[11].Value = model.dhe;
			parameters[12].Value = model.azs;
			parameters[13].Value = model.aze;
			parameters[14].Value = model.azsum;
			parameters[15].Value = model.yxgzs;
			parameters[16].Value = model.yxgze;
			parameters[17].Value = model.yxbfs;
			parameters[18].Value = model.yxbfe;
			parameters[19].Value = model.yxsum;
			parameters[20].Value = model.ylmark;
			parameters[21].Value = model.scmark;
			parameters[22].Value = model.zzmark;
			parameters[23].Value = model.shmark;
			parameters[24].Value = model.dhmark;
			parameters[25].Value = model.azmark;
			parameters[26].Value = model.yxzlmark;
			parameters[27].Value = model.pfdatetime;

			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
        public int Add(int mothid)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into gradeinfo(");
            strSql.Append("monthsupplyid,pfdatetime)");
            strSql.Append(" values (");
            strSql.Append("@monthsupplyid,@pfdatetime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
                    new SqlParameter("@monthsupplyid", SqlDbType.Int,4),                   
                    new SqlParameter("@pfdatetime", SqlDbType.DateTime)};
            parameters[0].Value = mothid;
            parameters[1].Value = DateTime.Now;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lcs.Model.gradeinfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update gradeinfo set ");
			strSql.Append("monthsupplyid=@monthsupplyid,");
			strSql.Append("yls=@yls,");
			strSql.Append("yle=@yle,");
			strSql.Append("scs=@scs,");
			strSql.Append("sce=@sce,");
			strSql.Append("scwte1=@scwte1,");
			strSql.Append("zzs=@zzs,");
			strSql.Append("zze=@zze,");
			strSql.Append("shs=@shs,");
			strSql.Append("she=@she,");
			strSql.Append("dhs=@dhs,");
			strSql.Append("dhe=@dhe,");
			strSql.Append("azs=@azs,");
			strSql.Append("aze=@aze,");
			strSql.Append("azsum=@azsum,");
			strSql.Append("yxgzs=@yxgzs,");
			strSql.Append("yxgze=@yxgze,");
			strSql.Append("yxbfs=@yxbfs,");
			strSql.Append("yxbfe=@yxbfe,");
			strSql.Append("yxsum=@yxsum,");
			strSql.Append("ylmark=@ylmark,");
			strSql.Append("scmark=@scmark,");
			strSql.Append("zzmark=@zzmark,");
			strSql.Append("shmark=@shmark,");
			strSql.Append("dhmark=@dhmark,");
			strSql.Append("azmark=@azmark,");
			strSql.Append("yxzlmark=@yxzlmark,");
			strSql.Append("pfdatetime=@pfdatetime");
			strSql.Append(" where gdid=@gdid");
			SqlParameter[] parameters = {
					new SqlParameter("@monthsupplyid", SqlDbType.Int,4),
					new SqlParameter("@yls", SqlDbType.Float,8),
					new SqlParameter("@yle", SqlDbType.Float,8),
					new SqlParameter("@scs", SqlDbType.Float,8),
					new SqlParameter("@sce", SqlDbType.Float,8),
					new SqlParameter("@scwte1", SqlDbType.Float,8),
					new SqlParameter("@zzs", SqlDbType.Float,8),
					new SqlParameter("@zze", SqlDbType.Float,8),
					new SqlParameter("@shs", SqlDbType.Float,8),
					new SqlParameter("@she", SqlDbType.Float,8),
					new SqlParameter("@dhs", SqlDbType.Float,8),
					new SqlParameter("@dhe", SqlDbType.Float,8),
					new SqlParameter("@azs", SqlDbType.Float,8),
					new SqlParameter("@aze", SqlDbType.Float,8),
					new SqlParameter("@azsum", SqlDbType.Float,8),
					new SqlParameter("@yxgzs", SqlDbType.Float,8),
					new SqlParameter("@yxgze", SqlDbType.Float,8),
					new SqlParameter("@yxbfs", SqlDbType.Float,8),
					new SqlParameter("@yxbfe", SqlDbType.Float,8),
					new SqlParameter("@yxsum", SqlDbType.Float,8),
					new SqlParameter("@ylmark", SqlDbType.Float,8),
					new SqlParameter("@scmark", SqlDbType.Float,8),
					new SqlParameter("@zzmark", SqlDbType.Float,8),
					new SqlParameter("@shmark", SqlDbType.Float,8),
					new SqlParameter("@dhmark", SqlDbType.Float,8),
					new SqlParameter("@azmark", SqlDbType.Float,8),
					new SqlParameter("@yxzlmark", SqlDbType.Float,8),
					new SqlParameter("@pfdatetime", SqlDbType.DateTime),
					new SqlParameter("@gdid", SqlDbType.Int,4)};
			parameters[0].Value = model.monthsupplyid;
			parameters[1].Value = model.yls;
			parameters[2].Value = model.yle;
			parameters[3].Value = model.scs;
			parameters[4].Value = model.sce;
			parameters[5].Value = model.scwte1;
			parameters[6].Value = model.zzs;
			parameters[7].Value = model.zze;
			parameters[8].Value = model.shs;
			parameters[9].Value = model.she;
			parameters[10].Value = model.dhs;
			parameters[11].Value = model.dhe;
			parameters[12].Value = model.azs;
			parameters[13].Value = model.aze;
			parameters[14].Value = model.azsum;
			parameters[15].Value = model.yxgzs;
			parameters[16].Value = model.yxgze;
			parameters[17].Value = model.yxbfs;
			parameters[18].Value = model.yxbfe;
			parameters[19].Value = model.yxsum;
			parameters[20].Value = model.ylmark;
			parameters[21].Value = model.scmark;
			parameters[22].Value = model.zzmark;
			parameters[23].Value = model.shmark;
			parameters[24].Value = model.dhmark;
			parameters[25].Value = model.azmark;
			parameters[26].Value = model.yxzlmark;
			parameters[27].Value = model.pfdatetime;
			parameters[28].Value = model.gdid;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

        public bool UpdateZZ(lcs.Model.gradeinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update gradeinfo set ");           
            strSql.Append("yls=@yls,");
            strSql.Append("yle=@yle,");
            strSql.Append("scs=@scs,");
            strSql.Append("sce=@sce,");
            strSql.Append("scwte1=@scwte1,");
            strSql.Append("zzs=@zzs,");
            strSql.Append("zze=@zze,");            
            strSql.Append("ylmark=@ylmark,");
            strSql.Append("scmark=@scmark,");
            strSql.Append("zzmark=@zzmark,");            
            strSql.Append("pfdatetime=@pfdatetime");
            strSql.Append(" where gdid=@gdid");
            SqlParameter[] parameters = {
                    
                    new SqlParameter("@yls", SqlDbType.Float,8),
                    new SqlParameter("@yle", SqlDbType.Float,8),
                    new SqlParameter("@scs", SqlDbType.Float,8),
                    new SqlParameter("@sce", SqlDbType.Float,8),
                    new SqlParameter("@scwte1", SqlDbType.Float,8),
                    new SqlParameter("@zzs", SqlDbType.Float,8),
                    new SqlParameter("@zze", SqlDbType.Float,8),                    
                    new SqlParameter("@ylmark", SqlDbType.Float,8),
                    new SqlParameter("@scmark", SqlDbType.Float,8),
                    new SqlParameter("@zzmark", SqlDbType.Float,8),                   
                    new SqlParameter("@pfdatetime", SqlDbType.DateTime),
                    new SqlParameter("@gdid", SqlDbType.Int,4)};
            parameters[0].Value = model.yls;
            parameters[1].Value = model.yle;
            parameters[2].Value = model.scs;
            parameters[3].Value = model.sce;
            parameters[4].Value = model.scwte1;
            parameters[5].Value = model.zzs;
            parameters[6].Value = model.zze;
            parameters[7].Value = model.ylmark;
            parameters[8].Value = model.scmark;
            parameters[9].Value = model.zzmark;
            parameters[10].Value = model.pfdatetime;
            parameters[11].Value =model.gdid;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        public bool UpdateYS(lcs.Model.gradeinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update gradeinfo set ");            
            strSql.Append("shs=@shs,");
            strSql.Append("she=@she,");
            strSql.Append("dhs=@dhs,");
            strSql.Append("dhe=@dhe,");
           
            strSql.Append("shmark=@shmark,");
            strSql.Append("dhmark=@dhmark,");
            
            strSql.Append("pfdatetime=@pfdatetime");
            strSql.Append(" where monthsupplyid=@monthsupplyid");
            SqlParameter[] parameters = {
                   
                    
                    new SqlParameter("@shs", SqlDbType.Float,8),
                    new SqlParameter("@she", SqlDbType.Float,8),
                    new SqlParameter("@dhs", SqlDbType.Float,8),
                    new SqlParameter("@dhe", SqlDbType.Float,8),
                    
                    new SqlParameter("@shmark", SqlDbType.Float,8),
                    new SqlParameter("@dhmark", SqlDbType.Float,8),
                    
                    new SqlParameter("@pfdatetime", SqlDbType.DateTime),
                     new SqlParameter("@monthsupplyid", SqlDbType.Int,4)};
            parameters[0].Value = model.shs;
            parameters[1].Value = model.she;
            parameters[2].Value =  model.dhs;
            parameters[3].Value =  model.dhe;
            parameters[4].Value = model.shmark;
            parameters[5].Value = model.dhmark;
            parameters[6].Value = model.pfdatetime;
            parameters[7].Value = model.monthsupplyid; 
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool UpdateAZ(lcs.Model.gradeinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update gradeinfo set ");            
            strSql.Append("azs=@azs,");
            strSql.Append("aze=@aze,");
            strSql.Append("azsum=@azsum,");           
            strSql.Append("azmark=@azmark,");            
            strSql.Append("pfdatetime=@pfdatetime");
            strSql.Append(" where gdid=@gdid");
            SqlParameter[] parameters = {                    
                    new SqlParameter("@azs", SqlDbType.Float,8),
                    new SqlParameter("@aze", SqlDbType.Float,8),
                    new SqlParameter("@azsum", SqlDbType.Float,8),                   
                    new SqlParameter("@azmark", SqlDbType.Float,8),                    
                    new SqlParameter("@pfdatetime", SqlDbType.DateTime),
                    new SqlParameter("@gdid", SqlDbType.Int,4)};
            parameters[0].Value = model.azs;
            parameters[1].Value = model.aze;
            parameters[2].Value = model.azsum;
            parameters[3].Value = model.azmark;
            parameters[4].Value = model.pfdatetime;
            parameters[5].Value = model.gdid;            

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        public bool UpdateYX(lcs.Model.gradeinfo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update gradeinfo set ");           
            strSql.Append("yxgzs=@yxgzs,");
            strSql.Append("yxgze=@yxgze,");
            strSql.Append("yxbfs=@yxbfs,");
            strSql.Append("yxbfe=@yxbfe,");
            strSql.Append("yxsum=@yxsum,");            
            strSql.Append("yxzlmark=@yxzlmark,");
            strSql.Append("pfdatetime=@pfdatetime");
            strSql.Append(" where gdid=@gdid");
            SqlParameter[] parameters = {                   
                    new SqlParameter("@yxgzs", SqlDbType.Float,8),
                    new SqlParameter("@yxgze", SqlDbType.Float,8),
                    new SqlParameter("@yxbfs", SqlDbType.Float,8),
                    new SqlParameter("@yxbfe", SqlDbType.Float,8),
                    new SqlParameter("@yxsum", SqlDbType.Float,8),                   
                    new SqlParameter("@yxzlmark", SqlDbType.Float,8),
                    new SqlParameter("@pfdatetime", SqlDbType.DateTime),
                    new SqlParameter("@gdid", SqlDbType.Int,4)};
            parameters[0].Value = model.yxgzs;
            parameters[1].Value = model.yxgze;
            parameters[2].Value = model.yxbfs;
            parameters[3].Value = model.yxbfe;
            parameters[4].Value = model.yxsum;
            parameters[5].Value = model.yxzlmark;
            parameters[6].Value = model.pfdatetime;
            parameters[7].Value = model.gdid;           

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int gdid)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from gradeinfo ");
			strSql.Append(" where gdid=@gdid");
			SqlParameter[] parameters = {
					new SqlParameter("@gdid", SqlDbType.Int,4)
			};
			parameters[0].Value = gdid;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string gdidlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from gradeinfo ");
			strSql.Append(" where gdid in ("+gdidlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public lcs.Model.gradeinfo GetModel(int gdid)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 gdid,monthsupplyid,yls,yle,scs,sce,scwte1,zzs,zze,shs,she,dhs,dhe,azs,aze,azsum,yxgzs,yxgze,yxbfs,yxbfe,yxsum,ylmark,scmark,zzmark,shmark,dhmark,azmark,yxzlmark,pfdatetime from gradeinfo ");
			strSql.Append(" where gdid=@gdid");
			SqlParameter[] parameters = {
					new SqlParameter("@gdid", SqlDbType.Int,4)
			};
			parameters[0].Value = gdid;

			lcs.Model.gradeinfo model=new lcs.Model.gradeinfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				return DataRowToModel(ds.Tables[0].Rows[0]);
			}
			else
			{
				return null;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public lcs.Model.gradeinfo DataRowToModel(DataRow row)
		{
			lcs.Model.gradeinfo model=new lcs.Model.gradeinfo();
			if (row != null)
			{
				if(row["gdid"]!=null && row["gdid"].ToString()!="")
				{
					model.gdid=int.Parse(row["gdid"].ToString());
				}
				if(row["monthsupplyid"]!=null && row["monthsupplyid"].ToString()!="")
				{
					model.monthsupplyid=int.Parse(row["monthsupplyid"].ToString());
				}
				if(row["yls"]!=null && row["yls"].ToString()!="")
				{
					model.yls=decimal.Parse(row["yls"].ToString());
				}
				if(row["yle"]!=null && row["yle"].ToString()!="")
				{
					model.yle=decimal.Parse(row["yle"].ToString());
				}
				if(row["scs"]!=null && row["scs"].ToString()!="")
				{
					model.scs=decimal.Parse(row["scs"].ToString());
				}
				if(row["sce"]!=null && row["sce"].ToString()!="")
				{
					model.sce=decimal.Parse(row["sce"].ToString());
				}
				if(row["scwte1"]!=null && row["scwte1"].ToString()!="")
				{
					model.scwte1=decimal.Parse(row["scwte1"].ToString());
				}
				if(row["zzs"]!=null && row["zzs"].ToString()!="")
				{
					model.zzs=decimal.Parse(row["zzs"].ToString());
				}
				if(row["zze"]!=null && row["zze"].ToString()!="")
				{
					model.zze=decimal.Parse(row["zze"].ToString());
				}
				if(row["shs"]!=null && row["shs"].ToString()!="")
				{
					model.shs=decimal.Parse(row["shs"].ToString());
				}
				if(row["she"]!=null && row["she"].ToString()!="")
				{
					model.she=decimal.Parse(row["she"].ToString());
				}
				if(row["dhs"]!=null && row["dhs"].ToString()!="")
				{
					model.dhs=decimal.Parse(row["dhs"].ToString());
				}
				if(row["dhe"]!=null && row["dhe"].ToString()!="")
				{
					model.dhe=decimal.Parse(row["dhe"].ToString());
				}
				if(row["azs"]!=null && row["azs"].ToString()!="")
				{
					model.azs=decimal.Parse(row["azs"].ToString());
				}
				if(row["aze"]!=null && row["aze"].ToString()!="")
				{
					model.aze=decimal.Parse(row["aze"].ToString());
				}
				if(row["azsum"]!=null && row["azsum"].ToString()!="")
				{
					model.azsum=decimal.Parse(row["azsum"].ToString());
				}
				if(row["yxgzs"]!=null && row["yxgzs"].ToString()!="")
				{
					model.yxgzs=decimal.Parse(row["yxgzs"].ToString());
				}
				if(row["yxgze"]!=null && row["yxgze"].ToString()!="")
				{
					model.yxgze=decimal.Parse(row["yxgze"].ToString());
				}
				if(row["yxbfs"]!=null && row["yxbfs"].ToString()!="")
				{
					model.yxbfs=decimal.Parse(row["yxbfs"].ToString());
				}
				if(row["yxbfe"]!=null && row["yxbfe"].ToString()!="")
				{
					model.yxbfe=decimal.Parse(row["yxbfe"].ToString());
				}
				if(row["yxsum"]!=null && row["yxsum"].ToString()!="")
				{
					model.yxsum=decimal.Parse(row["yxsum"].ToString());
				}
				if(row["ylmark"]!=null && row["ylmark"].ToString()!="")
				{
					model.ylmark=decimal.Parse(row["ylmark"].ToString());
				}
				if(row["scmark"]!=null && row["scmark"].ToString()!="")
				{
					model.scmark=decimal.Parse(row["scmark"].ToString());
				}
				if(row["zzmark"]!=null && row["zzmark"].ToString()!="")
				{
					model.zzmark=decimal.Parse(row["zzmark"].ToString());
				}
				if(row["shmark"]!=null && row["shmark"].ToString()!="")
				{
					model.shmark=decimal.Parse(row["shmark"].ToString());
				}
				if(row["dhmark"]!=null && row["dhmark"].ToString()!="")
				{
					model.dhmark=decimal.Parse(row["dhmark"].ToString());
				}
				if(row["azmark"]!=null && row["azmark"].ToString()!="")
				{
					model.azmark=decimal.Parse(row["azmark"].ToString());
				}
				if(row["yxzlmark"]!=null && row["yxzlmark"].ToString()!="")
				{
					model.yxzlmark=decimal.Parse(row["yxzlmark"].ToString());
				}
				if(row["pfdatetime"]!=null && row["pfdatetime"].ToString()!="")
				{
					model.pfdatetime=DateTime.Parse(row["pfdatetime"].ToString());
				}
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select * ");
			strSql.Append(" FROM Vgradeinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where 1=1 "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" gdid,monthsupplyid,yls,yle,scs,sce,scwte1,zzs,zze,shs,she,dhs,dhe,azs,aze,azsum,yxgzs,yxgze,yxbfs,yxbfe,yxsum,ylmark,scmark,zzmark,shmark,dhmark,azmark,yxzlmark,pfdatetime ");
			strSql.Append(" FROM gradeinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获取记录总数
		/// </summary>
		public int GetRecordCount(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) FROM gradeinfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			object obj = DbHelperSQL.GetSingle(strSql.ToString());
			if (obj == null)
			{
				return 0;
			}
			else
			{
				return Convert.ToInt32(obj);
			}
		}
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("SELECT * FROM ( ");
			strSql.Append(" SELECT ROW_NUMBER() OVER (");
			if (!string.IsNullOrEmpty(orderby.Trim()))
			{
				strSql.Append("order by T." + orderby );
			}
			else
			{
				strSql.Append("order by T.gdid desc");
			}
			strSql.Append(")AS Row, T.*  from gradeinfo T ");
			if (!string.IsNullOrEmpty(strWhere.Trim()))
			{
				strSql.Append(" WHERE " + strWhere);
			}
			strSql.Append(" ) TT");
			strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "gradeinfo";
			parameters[1].Value = "gdid";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  BasicMethod
		#region  ExtensionMethod

		#endregion  ExtensionMethod
	}
}

